<div class="panel panel-default" ng-controller="Responder_Controller"><div class="panel-heading"><h4 class="panel-title pull-left">{{title}}</h4><span class="pull-right">{{version}}</span><div class="clearfix"></div></div></div>

<div class="row">
    <div class="col-md-4">
        <div class="panel panel-default" ng-controller="Responder_ControlsController">
            <div class="panel-heading">
              <h3 class="panel-title">
                Controls
                <span class="dropdown">
                    <ul class="dropdown-menu" aria-labelledby="poolDropdown">
                        <li ng-click="saveAutostartSettings()"><a>Save settings for start on boot</a></li>
                    </ul>
                    <button class="btn btn-xs btn-{{saveSettingsLabel}} dropdown-toggle" type="button" id="poolDropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                        <span class="caret"></span>
                    </button>
                </span>
              </h3>
            </div>
			<div class="panel-body">
				<table style="width:100%">
					<tr>
						<td style="padding-bottom: .5em;" class="text-muted">Dependencies</td>
            <td ng-hide="$root.status.installed" style="text-align:right;padding-bottom: .5em;"><button type="button" style="width: 90px;" class="btn btn-{{installLabel}} btn-xs" data-toggle="modal" data-target="#dependenciesInstallModal" ng-disabled="processing">{{install}}</button></td>
            <td ng-show="$root.status.installed" style="text-align:right;padding-bottom: .5em;"><button type="button" style="width: 90px;" class="btn btn-{{installLabel}} btn-xs" data-toggle="modal" data-target="#dependenciesRemoveModal" ng-disabled="processing">{{install}}</button></td>
					</tr>
					<tr class="form-inline" ng-show="$root.status.installed">
						<td style="padding-bottom: .5em;" class="text-muted">Responder</td>
						<td style="text-align:right;padding-bottom: .5em;">
              <select class="form-control input-sm" ng-disabled="starting || status == 'Stop'" ng-model="selectedInterface">
                  <option ng-repeat="interface in interfaces">{{ interface }}</option>
              </select>
              <button type="button" style="width: 90px;" class="btn btn-{{statusLabel}} btn-xs" ng-disabled="starting" ng-click="toggleResponder()">{{status}}</button>
            </td>
					</tr>
					<tr ng-show="$root.status.installed">
						<td style="padding-bottom: .5em;" class="text-muted">Start on boot</td>
						<td style="text-align:right;padding-bottom: .5em;">
							<div class="btn-group">
								<button ng-click="toggleResponderOnBoot()" class="btn btn-xs btn-{{bootLabelON}}">ON</button>
								<button ng-click="toggleResponderOnBoot()" class="btn btn-xs btn-{{bootLabelOFF}}">OFF</button>
							</div>
						</td>
					</tr>
				</table>
			</div>

      <div class="modal fade" id="dependenciesInstallModal" tabindex="-1" role="dialog" aria-labelledby="dependenciesModalLabel">
        <div class="modal-dialog" role="document">
          <div class="modal-content">
            <div class="modal-header">
              <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
              <h4 class="modal-title" id="dependenciesInstallModalLabel">Install dependencies</h4>
            </div>
            <div class="modal-body">
              All required dependencies have to be installed first. This may take a few minutes.<br /><br />
              Please wait, do not leave or refresh this page. Once the install is complete, this page will refresh automatically.
            </div>
            <div class="modal-footer">
              <button type="button" class="btn btn-info" ng-click="handleDependencies('internal')" data-dismiss="modal">Internal</button>
              <button type="button" class="btn btn-info" ng-hide="device == 'tetra' || sdAvailable == false" ng-click="handleDependencies('sd')" data-dismiss="modal">SD Card</button>
            </div>
          </div>
        </div>
      </div>

      <div class="modal fade" id="dependenciesRemoveModal" tabindex="-1" role="dialog" aria-labelledby="dependenciesModalLabel">
        <div class="modal-dialog" role="document">
          <div class="modal-content">
            <div class="modal-header">
              <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
              <h4 class="modal-title" id="dependenciesRemoveModalLabel">Remove dependencies</h4>
            </div>
            <div class="modal-body">
              All required dependencies will be removed. This may take a few minutes.<br /><br />
              Please wait, do not leave or refresh this page. Once the remove is complete, this page will refresh automatically.
            </div>
            <div class="modal-footer">
              <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
              <button type="button" class="btn btn-info" ng-click="handleDependencies()" data-dismiss="modal">Confirm</button>
            </div>
          </div>
        </div>
      </div>

        </div>
    </div>
</div>

<div class="panel panel-default" ng-show="$root.status.installed" ng-controller="Responder_SettingsController">
    <div class="panel-heading pointer" data-toggle="collapse" data-target="#Settings">
        <h4 class="panel-title">Settings</h4>
    </div>
    <div id="Settings" class="panel-collapse collapse">
	    <div class="panel-body">

        <div class="form-group">
            <div class="btn-group pull-right">
              <button class="btn btn-{{saveSettingsLabel}} btn-sm" ng-disabled="saving" ng-click="setSettings()">{{saveSettings}}</button>
            </div>
            <div class="clearfix"></div>
        </div>

        <div class="form-group">
            <div class="input-group">
              <span class="help-block">Protocols:</span>
              <label class="checkbox-inline"><input type="checkbox" ng-model="settings.SQL"> SQL</label>
              <label class="checkbox-inline"><input type="checkbox" ng-model="settings.SMB"> SMB</label>
              <label class="checkbox-inline"><input type="checkbox" ng-model="settings.Kerberos"> Kerberos</label>
              <label class="checkbox-inline"><input type="checkbox" ng-model="settings.FTP"> FTP</label>
              <label class="checkbox-inline"><input type="checkbox" ng-model="settings.POP"> POP</label>
              <label class="checkbox-inline"><input type="checkbox" ng-model="settings.SMTP"> SMTP</label>
              <label class="checkbox-inline"><input type="checkbox" ng-model="settings.IMAP"> IMAP</label>
              <label class="checkbox-inline"><input type="checkbox" ng-model="settings.HTTP"> HTTP</label>
              <label class="checkbox-inline"><input type="checkbox" ng-model="settings.HTTPS"> HTTPS</label>
              <label class="checkbox-inline"><input type="checkbox" ng-model="settings.DNS"> DNS</label>
              <label class="checkbox-inline"><input type="checkbox" ng-model="settings.LDAP"> LDAP</label>
            </div>
        </div>

        <div class="form-group">
            <div class="input-group">
              <span class="help-block">Options:</span>
              <div class="checkbox"><label><input type="checkbox" ng-model="settings.basic"> Return a Basic HTTP authentication.</label></div>
              <div class="checkbox"><label><input type="checkbox" ng-model="settings.wredir"> Enable answers for netbios wredir suffix queries. Answering to wredir will likely break stuff on the network.</label></div>
              <div class="checkbox"><label><input type="checkbox" ng-model="settings.NBTNS"> Enable answers for netbios domain suffix queries. Answering to domain suffixes will likely break stuff the network.</label></div>
              <div class="checkbox"><label><input type="checkbox" ng-model="settings.fingerprint"> This option allows you to fingerprint a host that issued an NBT-NS or LLMNR query.</label></div>
              <div class="checkbox"><label><input type="checkbox" ng-model="settings.wpad"> Start the WPAD rogue proxy server.</label></div>
              <div class="checkbox"><label><input type="checkbox" ng-model="settings.forceWpadAuth"> Force NTLM/Basic authentication on wpad.dat file retrieval. This may cause a login prompt.</label></div>
              <div class="checkbox"><label><input type="checkbox" ng-model="settings.proxyAuth"> Force NTLM (transparently)/Basic (prompt) authentication for the proxy. WPAD doesn't need to be ON. This option is highly effective when combined with -r.</label></div>
              <div class="checkbox"><label><input type="checkbox" ng-model="settings.forceLmDowngrade"> Force LM hashing downgrade for Windows XP/2003 and earlier.</label></div>
              <div class="checkbox"><label><input type="checkbox" ng-model="settings.verbose"> Increase verbosity.</label></div>
              <div class="checkbox"><label><input type="checkbox" ng-model="settings.analyse"> Analyze mode. This option allows you to see NBT-NS, BROWSER, LLMNR requests without responding.</label></div>
            </div>
        </div>

	    </div>
	</div>
</div>

<div class="panel panel-default" ng-show="$root.status.installed" ng-controller="Responder_OutputController">
	<div class="panel-heading">
        <h4 class="panel-title pull-left">Output</h4>
		<div class="pull-right">
			Auto-refresh <div class="btn-group">
			<button ng-click="toggleAutoRefresh()" class="btn btn-xs btn-{{refreshLabelON}}">ON</button>
			<button ng-click="toggleAutoRefresh()" class="btn btn-xs btn-{{refreshLabelOFF}}">OFF</button>
			</div>
		</div>
		<div class="clearfix"></div>
    </div>
    <div class="panel-body">
        <div class="input-group">
            <span class="input-group-addon input-sm">Filter</span>
            <input type="text" class="form-control input-sm" placeholder="Piped commands used to filter output (e.g. grep, awk)" ng-model="filter">
            <div class="input-group-btn">
            	<button class="btn btn-default btn-sm" ng-click="clearFilter()">Clear Filter</button>
            	<button class="btn btn-primary btn-sm" ng-click="refreshOutput()">Refresh Log</button>
			</div>
        </div>
		<pre class="scrollable-pre log-pre">{{output}}</pre>
    </div>
</div>

<div class="panel panel-default" ng-show="$root.status.installed" ng-controller="Responder_HistoryController">
    <div class="panel-heading pointer" data-toggle="collapse" data-target="#History">
        <h4 class="panel-title">History <span class="badge">{{history.length}}</span></h4>
    </div>
    <div id="History" class="panel-collapse collapse">
        <div class="panel-body">
	        <button class="btn btn-primary btn-sm pull-right" ng-click="refreshHistory()">Refresh History</button><div class="clearfix"></div>
			<div class="table-responsive">
	            <table class="table table-striped table-bordered table-hover" ng-hide="(history.length == 0)">
	                <thead>
	                    <tr>
	                        <th>Date</th>
	                        <th>Action</th>
	                    </tr>
	                </thead>
	                <tbody>
	                    <tr ng-repeat="entry in history" ng-if="entry != ''">
	                        <td>{{entry[0]}}</td>
	                        <td>
								<div class="btn-group">
									<button type="button" class="btn btn-fixed-length btn-sm btn-default" data-toggle="modal" data-target="#historyModal" ng-click="viewHistory(entry[1])">View</button>
									<button type="button" class="btn btn-sm btn-default" ng-click="downloadHistory(entry[1])">Download</button>
                  <button type="button" class="btn btn-fixed-length btn-sm btn-danger" ng-click="deleteHistory(entry[1])">Delete</button>
								</div>
							</td>
	                    </tr>
	                </tbody>
	            </table>
	        </div>
			<div class="well" ng-show="(history.length === 0)">No history...</div>
        </div>
    </div>

	<div class="modal fade" id="historyModal" tabindex="-1" role="dialog" aria-labelledby="historyModalLabel">
	  <div class="modal-dialog modal-lg" role="document">
	    <div class="modal-content">
	      <div class="modal-header">
	        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
	        <h4 class="modal-title" id="historyModalLabel">View History - {{historyDate}}</h4>
	      </div>
	      <div class="modal-body">
	      <pre class="scrollable-pre log-pre">{{historyOutput}}</pre>
	      </div>
	      <div class="modal-footer">
	        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
	      </div>
	    </div>
	  </div>
	</div>

</div>
